package servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import atm.ATM;

/**
 * 
     * @ClassName: ToIndexServlet
     * @Description: 返回首页操作
     * @author Huang_shengjun
     * @date 2020年5月29日 下午2:41:11
     *
 */
public class ToIndexServlet extends HttpServlet{

	private static final long serialVersionUID = 1L;

	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		System.out.println("==ToIndexServlet===返回首页==");
		ATM.getInstance().getSession().toIndex();

		String json = ATM.getInstance().getResponse();
		resp.setContentType("text/json");
		resp.setCharacterEncoding("UTF-8");
		resp.getWriter().write(json);
	}

	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		doGet(req, resp);
	}
}
